package com.itheima.d3_annotation;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class AnnotionTest {
    @MyTest
    public void test1(){
        System.out.println("====test1====");
    }

    //@MyTest
    public void test2(){
        System.out.println("====test2====");
    }

    @MyTest
    public void test3(){
        System.out.println("====test3====");
    }

    //@MyTest
    public void test4(){
        System.out.println("====test4====");
    }

    public static void main(String[] args) throws Exception {
        AnnotionTest a =new AnnotionTest();

        Class c=AnnotionTest.class;

        Method[] methods = c.getDeclaredMethods();
        for (Method method : methods) {
            if(method.isAnnotationPresent(MyTest.class)){
                method.invoke(a);
            }
        }

    }
}
